package com.geotmt.billingcenter.modules.consume.mapper;

import com.geotmt.billingcenter.common.entry.ConsumeBaseEntry;
import com.geotmt.billingcenter.common.vo.consume.ConsumeHisVo;
import com.geotmt.billingcenter.common.vo.consume.ConsumeVo;
import com.geotmt.billingcenter.common.vo.params.ParamsConsume;
import com.geotmt.billingcenter.common.vo.params.ParamsForDel;
import com.geotmt.billingcenter.modules.consume.mapper.provider.ConsumeBaseProvider;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Description 消耗配置 base Mappper
 * @Author      yanghanwei
 * @Mail        yanghanwei@geotmt.com
 * @Date        2019/3/13 10:56
 * @Version     v1
 **/
@Mapper
@Repository
public interface ConsumeBaseMapper {
    /**
     * 添加消耗规则配置 base
     * @param consumeBase
     * @return
     */
    @InsertProvider(type = ConsumeBaseProvider.class, method = "add")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    Integer addBase(ConsumeBaseEntry consumeBase);

    /**
     * 修改 base
     * feeFlag  updateUserId updateTime
     * @param consumeRule
     * @return
     */
    @UpdateProvider(type = ConsumeBaseProvider.class, method = "update")
    int updateBase(ConsumeVo consumeRule);

    /**
     * 删除 消耗配置 base (逻辑删除)
     * @param id
     * @return
     */
    @UpdateProvider(type = ConsumeBaseProvider.class, method = "delete")
    int deleteBase(ParamsForDel id);

    /**
     * 消耗list
     * @param obj
     * @return
     */
    @SelectProvider(type = ConsumeBaseProvider.class, method = "list")
    List<ConsumeVo> listCurr(ParamsConsume obj);

    /**
     * 消耗list
     * @param obj
     * @return
     */
    @SelectProvider(type = ConsumeBaseProvider.class, method = "listAll")
    List<ConsumeVo> listAll(ParamsConsume obj);

    /**
     * 消耗 getById
     * @param id
     * @return
     */
    @SelectProvider(type = ConsumeBaseProvider.class, method = "getById")
    ConsumeVo getById(Integer id);

    /**
     * 获取当前有效的规则
     * @param code
     * @param companyId
     * @param cuserId
     * @param interfaceId
     * @param date
     * @return
     */
    @SelectProvider(type = ConsumeBaseProvider.class, method = "getConsume")
    ConsumeHisVo getConsume(@Param(value = "code") String code,
                            @Param(value = "companyId") Integer companyId,
                            @Param(value = "cuserId") Integer cuserId,
                            @Param(value = "interfaceId") Integer interfaceId,
                            @Param(value = "date") String date);


}
